package com.zzc.service;

import com.zzc.bean.Dining;
import com.zzc.dao.DiningDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

public class DiningService {
	DiningDao diningDao;
	public void setDiningDao(DiningDao diningDao) {
		this.diningDao = diningDao;
	}
	public void initCourses(){
		Dining dining1 =new Dining();
		Dining dining2 =new Dining();
		Dining dining3 =new Dining();
		Dining dining4 =new Dining();
		Dining dining5 =new Dining();
		Dining dining6 =new Dining();
		Dining dining7 =new Dining();

		diningDao.getSession().saveOrUpdate(dining1);
		diningDao.getSession().saveOrUpdate(dining2);
		diningDao.getSession().saveOrUpdate(dining3);
		diningDao.getSession().saveOrUpdate(dining4);
		diningDao.getSession().saveOrUpdate(dining5);
		diningDao.getSession().saveOrUpdate(dining6);
		diningDao.getSession().saveOrUpdate(dining7);
	}
	public void addCourse(Dining dining){
		diningDao.getSession().saveOrUpdate(dining);
	}
	public void deleteCourse(){

	}
	public void alterCourse() {

	}
	public List<Dining> getAll(){
		return diningDao.getAll();
	}

//	public List<Dining> getCourses_xuanxiu1() {
//		List<Dining> lilist_courses_xuanxiu1=new ArrayList<Dining>();
//		List<Dining> list_scs= diningDao.getAll();
//		for (Dining dining :list_scs){
//			if (dining.getType().equals("2")){
//				lilist_courses_xuanxiu1.add(dining);
//			}
//		}
//		return lilist_courses_xuanxiu1;
//	}
//	public List<Dining> getCourses_xuanxiu2() {
//		List<Dining> lilist_courses_xuanxiu2=new ArrayList<Dining>();
//		List<Dining> list_scs= diningDao.getAll();
//		for (Dining dining :list_scs){
//			if (dining.getType().equals("3")){
//				lilist_courses_xuanxiu2.add(dining);
//			}
//		}
//		return lilist_courses_xuanxiu2;
//	}
}
